#!/bin/bash
ANSIBLE_HOME='/usr/local/ansible_ui'
PROJECT_PATH='/usr/local/ansible_ui/projects'
for PROJECT_NAME in `sudo find ${PROJECT_PATH} -mindepth 1 -maxdepth 1 -type d -printf "%P\n"`;do
TMP_PATH="${PROJECT_PATH}/${PROJECT_NAME}"
if [[ -d ${TMP_PATH} ]];then
[[ -f ${TMP_PATH}/inventories/hosts ]] && sudo chmod -x ${TMP_PATH}/inventories/hosts
[[ -d ${TMP_PATH}/.tmp ]] && sudo chmod +x ${TMP_PATH}/.tmp
sudo mkdir -p ${TMP_PATH}/.tmp/desktop/core
sudo touch ${ANSIBLE_HOME}/desktop/core/tmp &>/dev/null 2>&1
sudo ln -sf ${ANSIBLE_HOME}/desktop/core/tmp ${TMP_PATH}/.tmp/desktop/core/
fi
done
